<!--
 * @Description: 
 * @Author: wlj
 * @Date: 2022-12-22 17:09:07
 * @LastEditors: wlj
 * @LastEditTime: 2023-01-05 15:47:46
 * @FilePath: \my-vite-app\src\views\child.vue
-->
<template>
  <h4>child组件</h4>
  <p>姓名：{{ systemName }}</p>
  <p>年龄：{{ age }}</p>
  <p>性别：{{ sex }}</p>
  <button @click="changeName">更改姓名</button>

  <a-image :width="200" src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" />
</template>
<script setup lang="ts">
// import { storeToRefs } from "pinia";
import Store from '@/store/index'
const store = Store()
const { name, age, sex } = storeToRefs(store.user)
const { name: systemName } = storeToRefs(store.system)

const changeName = () => {
  // store.system.name = "lily";
  store.system.changeUserName('通过system修改user中name的值')
}
</script>
<style scoped></style>
